//第一种写法
//type First<T extends any[]> =T extends [] ? never: T[0]


//第二种写法
//type First<T extends any[]> = T['length'] extends 0 ? never :T[0]

//第三种写法
//type First<T extends any[]> = T[0] extends T[number] ? T[0] :never

//第四种写法

type First<T extends any[]> = T extends [infer first, ... infer rest] ? first : never

type arr = [5,2,3,4]
type arr1 = arr[number]



const first = (arr)=>{
    if(!arr.length) return 'nerver'
    return arr[0]
}

//知识点

//1. extends 类型条件判断
//2. 获取 tuple 的length 属性 indexed
//3. extends union 联合类型判断
//4. inherf  推断判断  类似解构